<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增服务商分润调整项')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form  enctype="multipart/form-data" class="form-horizontal m" id="form-distributionAdjust-upload">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">选择文件：</label>
                <div class="col-sm-8">
                    <span class="btn btn-white btn-file">
                        <input type="file" name="file"  accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
                    </span>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "agentInfo/distributionAdjust"
        $("#form-distributionAdjust-upload").validate({
            rules: {
                file:{
                    required: true
                }
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var formData = new FormData();
                formData.append("file", $("[name = 'file']")[0].files[0]);
                // $.operate.save(, formData);
                $.ajax({
                    url: prefix + "/upload",
                    data: formData,
                    type: "post",
                    processData: false,
                    contentType: false,
                    success: function(result) {
                        $.operate.saveSuccess(result);
                    }
                })
            }
        }
    </script>
</body>
</html>